package com.ls.smartcampus2.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ls.smartcampus2.pojo.Score;
import com.ls.smartcampus2.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dell
 */
@RestController
public class ScoreController {
    @Autowired
    private ScoreService scoreService;
    @GetMapping("/queryScoreBySemeItem")
    public String queryScoreBySemeItem(String sid,Integer semeitem) throws JsonProcessingException {
        ObjectMapper mapper=new ObjectMapper();
//        semitem=1;
//        sid="1743205000113";
        System.out.println(sid);
        System.out.println(semeitem);
        List<Score> scores = scoreService.queryScoreBySemeItem(sid,semeitem);
        String s = mapper.writeValueAsString(scores);
        return s;
    }
}
